/*
 * 福建创识科技股份有限公司 © Chase Science Co.,Ltd
 *
 * 源代码：HomePageController.java
 */
package cn.echase.ecare.yinfayun.controller;

import cn.echase.ecare.yinfayun.domain.vo.*;
import cn.echase.ecare.yinfayun.service.HomePageService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.core.domain.R;

/**
 * 首页-控制器。
 *
 * @author Len (tl@echase.cn)
 * @date 2025-05-12
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/homePage")
public class HomePageController extends BaseController {

    private final HomePageService homePageService;

    /**
     * 院区概况
     */
    @GetMapping("/overviewOfCampus/get")
    public R<OverviewOfCampusVo> getOverviewOfCampus() {
        return R.ok(homePageService.queryOverviewOfCampus());
    }

    /**
     * 今日动态
     */
    @GetMapping("/todaysUpdates/get")
    public R<TodaysUpdatesVo> getTodaysUpdates() {
        return R.ok(homePageService.queryTodaysUpdates());
    }

    /**
     * 待办任务
     */
    @GetMapping("/toDoTask/get")
    public R<ToDoTaskVo> getToDoTask() {
        return R.ok(homePageService.queryToDoTask());
    }

    /**
     * 事项提醒
     */
    @GetMapping("/reminderOfMatters/get")
    public R<ReminderOfMattersVo> getReminderOfMatters() {
        return R.ok(homePageService.queryReminderOfMatters());
    }

    /**
     * 常用功能
     */
    @GetMapping("/commonFunction/get")
    public R<CommonFunctionVo> getCommonFunction() {
        return R.ok(homePageService.queryCommonFunction());
    }

    /**
     * 长者年龄及性别分布
     */
    @GetMapping("/ageAndGenderDistributionOfElderly/get")
    public R<AgeAndGenderDistributionOfElderlyVo> getAgeAndGenderDistributionOfElderly() {
        return R.ok(homePageService.queryAgeAndGenderDistributionOfElderly());
    }

    /**
     * 照护等级分布
     */
    @GetMapping("/distributionOfCareLevels/get")
    public R<DistributionOfCareLevelsVo> getDistributionOfCareLevels() {
        return R.ok(homePageService.queryDistributionOfCareLevels());
    }

    /**
     * 入/退住趋势（近一年）
     */
    @GetMapping("/trendOfEntryAndExitInYear/get")
    public R<TrendOfEntryAndExitInYearVo> getTrendOfEntryAndExitInYear() {
        return R.ok(homePageService.queryTrendOfEntryAndExitInYear());
    }
}
